<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;
class GoodsController extends BaseController {
	private $tbl;
	public function _initialize(){
		$this->tbl='goods';
		$this->model=D($this->tbl);
		parent::_initialize();
	}
	public function index(){
		parent::index($this->tbl);
	}
	public function	view(){
		$id=I('get.id');//获取id
	}
	public function	show(){
		$id=I('get.id');
		//所有信息
		$sql="select * from yjl_goods where yjl_id={$id}";
		$data1=M()->query($sql);
		$this->assign("good",$data1);
		
		// var_dump($data1);
		//echo "dsd";
		//分类信息
		$sql="select * from yjl_classify where yjl_id='{$data1[0]['yjl_classid']}'";
		
		$data1=M()->query($sql);
		$this->assign("classname",$data1);
		$this->display();
	}
	public function mod(){//修改界面
		$sql="select * from yjl_classify";
		$data1=M()->query($sql);
		$this->assign("idlist",$data1);
		 parent::mod($this->tbl,"yjl_id");
	}
	public function update(){//修改
		parent::update($this->tbl,"yjl_photo");
	}
	public function delete(){//删除
		parent::delete($this->tbl,"yjl_id","yjl_photo");
	}
	public function form(){//添加界面
		$sql="select * from yjl_classify";
		$data1=M()->query($sql);
		$this->assign("idlist",$data1);
		parent::form($this->tbl);
	}
	public function add(){//添加
		parent::add($this->tbl,"yjl_photo");
	}
	public function search(){
		parent::search($this->tbl,"yjl_name","yjl_name");
	}
}